<h1 class="heading">Evento list</h1>

<?php
	$form = new EventoForm();
	include_component(
    	'evento',
    	'filtro',
		array(
        	'filter' => $filter,
        	'form' => $form
		)
	);
?>

<br />

<?php if (count($evento_list)): ?>
<table class="paginacao" cellpadding="2" cellspacing="0" width="100%" align="center">
	<tr>
		<td align="left"><?php $pager_layout->displayResultados(); ?></td>
		<td align="right"><?php $pager_layout->display(); ?></td>
	</tr>
</table>
<?php endif; ?>

<table class="list">
	<thead>
    <tr>
	    <th><?php echo $form['id_evento']->renderLabel() ?></th>
	    <th><?php echo $form['nome']->renderLabel() ?></th>
	    <th><?php echo $form['data_evento']->renderLabel() ?></th>
	    <th>Ações</th>
	    </tr>
	</thead>
  	<tbody>
  	<?php if (!count($evento_list)): ?>
	<tr>
		<td align="center" colspan="5">NENHUM REGISTRO ENCONTRADO!</td>
	</tr>
	<?php endif; ?>
	<?php $i = 0; ?>
    <?php foreach ($evento_list as $evento): ?>
    <?php $bg = ($i++ % 2 == 0)? 'row0' : 'row1'; ?>
    <tr class="<?php echo $bg; ?>">
	    <td><a href="<?php echo url_for('evento/show?id_evento='.$evento['id_evento']) ?>"><?php echo $evento['id_evento'] ?></a></td>
	    <td><?php echo $evento['nome'] ?></td>
	    <td><?php echo format_date($evento['data_evento'], 'p'); ?></td>
	    <td>
	    	<?php
	            echo link_to(
	                ' ',
	                url_for('evento/show?id_evento='.$evento['id_evento']),
	                array('class'=>'icoVisualizar','title'=>'Visualizar Evento')
	            )
            ?>
	    	<?php
	            echo link_to(
	                ' ',
	                url_for('evento/edit?id_evento='.$evento['id_evento']),
	                array('class'=>'icoEditar','title'=>'Editar Evento')
	            )
            ?>
	    	<?php
	            echo link_to(
	                ' ',
	                url_for('evento/delete?id_evento='.$evento['id_evento']),
	                array('class'=>'icoExcluir','title'=>'Excluir Evento', 'confirm' => 'Tem certeza que deseja Excluir?')
	            )
            ?>
	    </td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<?php
	comandos_form(
		null,
				link_to(
			':: Inserir ::',
			'evento/new',
			array('class' => 'botao')
		)
			)
?>